package cn.ccew.sys.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import cn.ccew.common.base.model.BaseEntity;

/**
 * 资源分配
 * 
 * @author lxj
 * 
 */
//@Entity
//@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
//@Table(name = "sys_allocation")
public class SysAllocation extends BaseEntity {
	/**
	 * 所属资源
	 */
	@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "resources_id")
	private SysResources resources;
	/**
	 * 所有操作
	 */
	// 级联保存、更新、删除、刷新;延迟加载
	@OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
	// 在book表增加一个外键列来实现一对多的单向关联
	@JoinColumn(name = "authorize_id")
	private Set<SysOperating> operating = new HashSet<SysOperating>();

	public SysResources getResources() {
		return resources;
	}

	public void setResources(SysResources resources) {
		this.resources = resources;
	}

	public Set<SysOperating> getOperating() {
		return operating;
	}

	public void setOperating(Set<SysOperating> operating) {
		this.operating = operating;
	}

}
